#!/usr/bin/env python
import os
import xmmsclient.glib
from gtk import Window, HBox, VBox, main, main_quit
from acover import CoverView
from playlist import Playlist
from player import Player
from xmmsclient import XMMS

xmms2 = XMMS("player_connected")
try:
    xmms2.connect(os.getenv("XMMS_PATH"))
except Exception, e:
    print "[xmms2 client]: Could not connect to xmms2d"
    print e
    print "Aborting!"
    exit(1)
xmmsclient.glib.GLibConnector(xmms2)
    
pl = Playlist(xmms2)
pl.set_name("my playlist")
pl.load_playlist()

cv = CoverView(xmms2)
cv.set_cover()
player =Player(xmms2)

w = Window()
w.set_title("Xmms2")
w.connect("delete-event", lambda w, e: main_quit())

vbox = VBox()
hbox = HBox()
hbox.pack_start(cv)
hbox.pack_start(pl)
vbox.pack_start(hbox)
vbox.pack_start(player, expand=False)

w.add(vbox)
w.show_all()
main()
